package com.gdth.core.db;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.os.Build;

public class SqliteDbHelper extends SQLiteOpenHelper{
	
	private static String name = "aron.db";
	private static int version = 1;
	
	private static SqliteDbHelper instance;
	
	public static SqliteDbHelper getIntance(Context context){
		if (instance == null) {
			instance = new SqliteDbHelper(context);
		}
		
		return instance;
	}
	
	public SqliteDbHelper(Context context){
		super(context, name, null, version);
	}
	
	public SqliteDbHelper(Context context, String dbName){
		super(context, dbName, null, version);
	}
	
	public SqliteDbHelper(Context context, String dbName, int version){
		super(context, dbName, null, version);
	}
	
	@SuppressLint("NewApi")
	public SqliteDbHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
		if(Build.VERSION.SDK_INT >= 11){
			getWritableDatabase().enableWriteAheadLogging();
	    }

	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		
	}

}
